package fun.lifepoem.demo.controller;

import fun.lifepoem.demo.annotation.RequireRole;
import fun.lifepoem.demo.common.SessionManager;
import fun.lifepoem.demo.common.UserThreadLocal;
import fun.lifepoem.demo.domain.UserInfo;
import org.apache.http.Header;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Yiwyn
 * @create 2022/12/3 23:40
 */
@RestController
@RequestMapping("/demo")
public class DemoController {


    @RequireRole(value = {"admin", "vip"})
    @GetMapping("/hello")
    public String demo() {
        UserInfo userInfo = SessionManager.get();

        return "hello" + "！" + userInfo.toString();
    }
}
